using System;
using System.Collections.Generic;
using Loc.HibernateMini.Attributes;
using Loc.HibernateMini.IFaces;

namespace Loc.HibernateMini
{
    public abstract class DataBaseObjectsFactoryBase: IDataBaseObjectsFactory
    {
        private int _commandTimeout= 30;
        private string _sqlConnectionString;
        

        public int CommandTimeout
        {
            get { return _commandTimeout; }
            set { _commandTimeout = value; }
        }

        public string SqlConnectionString
        {
            get { return _sqlConnectionString; }
            protected set { _sqlConnectionString = value; }
        }

        public abstract void getFromDb(int id, ref IPersistent persistent);
        public abstract void getFromDb(int id, ref IPersistent persistent, bool initLazy);

        public abstract IList<IPersistent> getListFromDb(PersistentCollectionAttribute pca, ref IPersistent parent,
                                                         Type collectionObjectsClass);

        public abstract int CountCollectionItems(PersistentCollectionAttribute pca, IPersistent parent);
        public abstract void SaveOrUpdate(IPersistent persistent);
        public abstract void DeleteObject(ref IPersistent persistent);
    }
}